<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>路费问题</title>
</head>
<body>
<script>
    var kil = prompt("请输入您的里程");
    var ride;//里程
    var fee;//费用
    ride = kil
    if (kil > 3.0 && kil <= 10.0) {
        fee = (kil - 3.0) * 2.8 + 8.0
    } else if (kil > 10) {
        fee = 8.0 + (7.0 * 2.8) + ((kil - 10.0) * 3.0)
    } else {
        fee = 8.0
    }
    //总的费用
    total = Math.round(fee);
    document.write("您的行驶路程为：" + ride + "公里" + "四舍五入前的费用为：" + fee + "\n四舍五入后费用为：" + total + "元")
</script>
</body>
</html>